package test.boid.vo;

import java.util.HashMap;

import com.jme.image.Texture;
import com.jme.scene.Skybox;
import com.jme.scene.Skybox.Face;

import dviz.tools.ModelRepository;
import dviz.visualSystem.impl.AnimationObject;
import dviz.visualSystem.impl.BackgroundObject;


public class SkyBox extends AnimationObject implements BackgroundObject {

	public SkyBox(HashMap<String, Object> initVector) {
		super(initVector);
		String north = (String) initVector.get("north");
		String south = (String) initVector.get("south");
		String west = (String) initVector.get("west");
		String east = (String) initVector.get("east");
		String up = (String) initVector.get("up");

		// If faces not specified , use default value
		if (north == null || south == null || west == null || east == null
				|| up == null) {
			north = "skynorth";
			south = "skysouth";
			west = "skywest";
			east = "skyeast";
			up = "skyup";
		}

		com.jme.scene.Skybox box = new com.jme.scene.Skybox("SkyBox",50,50,50);
		HashMap<String, Object> modelRepository = ModelRepository.get()
				.getRepository();
		box.setTexture(Face.East, (Texture) modelRepository.get(east));
		box.setTexture(Face.South, (Texture) modelRepository.get(south));
		box.setTexture(Face.West, (Texture) modelRepository.get(west));
		box.setTexture(Face.North, (Texture) modelRepository.get(north));		
		box.setTexture(Face.Up, (Texture) modelRepository.get(up));

		getRenderNode().attachChild(box);
	}
}
